<template>
	<view class="main">
		<u-navbar back-text="" slot="center" :autoBack="true" safeAreaInsetTop placeholder>
			<view slot="center" class="leftText">完善信息</view>
		</u-navbar>
		<view class="mptop">
			<view>您的名片完善度<text>{{myCard.progress?myCard.progress:0}}</text>%</view>
			<view>置顶后可前往个人中心-我的名片中继续完善</view>
		</view>
		<view class="card-info">
			<!--list start-->
			<view class="master-item">
				<view class="master-faceItem poser dis-row">
					<!--头像处理start-->
					<view class="faceItem-ico">
						<image :src="myCard.avatar?myCard.avatar:'http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/default-avatar.png'"></image>
					</view>
					<!--头像处理over-->
					<!--顶部右侧标题文字开始-->
					<view class="faceText dis-clm">
						<!--置顶信息start-->
						<view class="faceText-t1 dis-row">
							<view class="master-name">{{myCard.nickName?myCard.nickName:'先生'}}</view>
							<text>{{myCard.mobile?myCard.mobile:'未设置'}}</text>
						</view>
						<!--置顶信息over-->
						<view class="master-userinfo dis-row">
							<block v-if="!myCard.nickName">个人基本信息待完善</block>
							<block v-if="myCard.nickName">
								<text>{{myCard.gender==1?'男':'女'}}</text>
								<text v-if="myCard.age">{{myCard.age}}岁</text>
								<text v-if="myCard.nationStr">{{myCard.nationStr}}</text>
							</block>
						</view>
					</view>
					<!--顶部右侧标题文字结束-->
					<!--是否在线开始-->
					<view class="card-titlleico dis-row" @click="navigator('../../pagesB/perfectWork/EditUserInfo')">
						<label><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/contacts/card-edit.svg"></image></label>
						<text>{{myCard.nickName?'修改':'完善'}}</text>
					</view>
					<!--是否在线结束-->
				</view>
				<!--标签列表开始-->
				<view class="contacts-gouceng dis-row">
					<label>人员构成</label><text>{{myCard.staffTypeStr?myCard.staffTypeStr:'未填'}}<text v-if="myCard.peopleNumStr">({{myCard.peopleNumStr}}人)</text></text>
					<label v-if="myCard.workYear">工龄</label><text>{{myCard.workYear?myCard.workYear+'年':'未填'}}</text>
					<label v-if="myCard.masteryStr">熟练度</label><text>{{myCard.masteryStr?myCard.masteryStr:'未填'}}</text>
				</view>
			</view>
			<!--list over-->
			<view class="card-childName poser">
				自我介绍
				<view class="child-titlleico dis-row" @click="navigator('/pagesB/perfectWork/introduce')">
					<label><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/contacts/card-edit.svg"></image></label>
					<text>修改</text>
				</view>
			</view>
			<view class="card-personper">{{myCard.notice?myCard.notice:'暂无介绍'}}
				<!-- <view class="audit">
					<view class="auditTitle">审核不通过</view>
					<view class="auditContent">你好，您在此处填写的自我介绍的信息，审核未通过。 请规范填写，如有疑问请联系天下工人客服</view>
				</view> -->
			</view>
			<view class="card-childName poser">
				找活信息
				<view class="child-titlleico dis-row" @click="navigator('/pagesB/perfectWork/findJob')">
					<label><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/contacts/card-edit.svg"></image></label>
					<text>修改</text>
				</view>
			</view>
			<view class="child-classInfo dis-clm">
				<view class="t-text dis-row" v-if="myCard.skills">
					<label>工种</label><text>{{myCard.skills.substring(0,myCard.skills.lastIndexOf(','))}}</text>
				</view>
				<view class="t-text dis-row" v-if="myCard.hopeAddr">
					<label>期望地点</label><text>{{myCard.hopeAddr.substring(0,myCard.hopeAddr.lastIndexOf(','))}}</text>
				</view>
				<view class="t-text dis-row" v-if="myCard.workType1Str">
					<label>长短工</label><text>{{myCard.workType1Str}}</text>
				</view>
				<view class="t-text dis-row">
					<label>结算方式</label><text>{{myCard.settlementStr?myCard.settlementStr:'暂无'}} 
					{{myCard.salary?'/'+myCard.salary:''}}{{myCard.salaryUnitStr?myCard.salaryUnitStr:''}}</text>
				</view>
				<view class="t-text dis-row" v-if="myCard.status!=null">
					<label>找活状态</label>
					<text v-if="myCard.status==0">找活中</text>
					<text v-if="myCard.status==1">暂不找活</text>
					<text v-if="myCard.status==2">有活预定下一个</text>
				</view>
				<view class="t-text dis-row" v-if="myCard.status==null">
					<label>找活状态</label>
					<text >暂不找活</text>
				</view>
			</view>
			<block  v-if="myCard.videoUrl">		
				<view class="card-childName poser">
					找活视频
				</view>
				<view class="t-video">
					<image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/my/1.jpg"></image>
				</view>
			</block>
				<!-- <view class="audit">
					<view class="auditTitle">审核不通过</view>
					<view class="auditContent">你好，您在此处填写的自我介绍的信息，审核未通过。 请规范填写，如有疑问请联系天下工人客服</view>
				</view> -->
			<view class="card-childName poser">
				项目经验
				<view class="child-titlleico dis-row" @click="navigator('../../pagesB/perfectWork/experience')">
					<label><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/contacts/card-add.svg"></image></label>
					<text>添加</text>
				</view>
			</view>
			<view class="card-xiangmujingli" v-for="(item,index) in myCard.productHistoryList">
				<view class="card-childName poser">
					{{item.enterpriseName}}
					<view class="child-titlleico dis-row" @click="navigator('../../pagesB/perfectWork/experience?id='+item.id)">
						<label><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/contacts/card-edit.svg"></image></label>
						<text>修改</text>
					</view>
				</view>
				<view class="card-xmtext">{{item.startTime}}-{{item.endTime}}</view>
				<view class="card-jingliInfo">
					{{item.remark}}
				</view>
				<view class="audit" v-if="item.auditStatus==2">
					<view class="auditTitle">审核不通过</view>
					<view class="auditContent">{{item.auditComment?item.auditComment:''}}</view>
				</view>
			</view>
			<view class="card-childName poser">
				技能证书
				<view class="child-titlleico dis-row" @click="navigator('../../pagesB/perfectWork/certificate')">
					<label><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/contacts/card-add.svg"></image></label>
					<text>添加</text>
				</view>
			</view>
			<block v-for="(item,index) in myCard.certificateInfoList">
				<view class="zhengshu">
					<view class="contacts-zhengshu dis-row">
						<image :src="item.imgUrl"></image>
						<view class="zhengshu-text dis-clm">
							<label class="child-label">{{item.cname}}</label>
							<view class="dis-row">
								<label>获得证书时间</label><text>{{item.issueDate}}</text>
							</view>
						</view>
						<view class="certEdit" @click="navigator('./certificate?id='+item.id)">
							<label><image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/contacts/card-edit.svg"></image></label>
							<text>修改</text>
						</view>				
					</view>
					<view class="audit" v-if="item.auditStatus==2">
						<view class="auditTitle">审核不通过</view>
						<view class="auditContent">{{item.auditComment?item.auditComment:''}}</view>
					</view>
				</view>
			</block>
		</view>
		<!--11-->
		<view style="height: 250rpx;"></view>
		<!--找活期望结束-->
		<view class="constacts-footer">
			<view class="footer-con dis-row">
				<view class="ft-v1 dis-clm" @click="conDel">
					<image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/contacts/yulan.png"></image>
					<text>预览</text>
				</view>
				<view class="ft-v1 dis-clm" @click="conBeizhu">
					<image src="http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/contacts/shuaxin.png"></image>
					<text>刷新</text>
				</view>
				<view class="ft-btn ft-pingjia" @click="dingyue">订阅</view>
				<view class="ft-btn ft-goutong" @click="topInsert">置顶</view>
			</view>
		</view>
	</view>
</template>

<script>
import pop from "@/components/ming-pop/ming-blow.vue"
import Index from "@/common/index-model.js"
let index = new Index()
let that = null	
export default {
	data() {
		return {
			myCard:{}
		}
	},
	onShow() {
		this.getCardDetail();
	},
	methods: {
		conDel() {
			let url="../../pagesB/workInfo/RecruitmentInfo?id="+this.myCard.userId
			console.log(url);
			index.navigate_to(url)
		},
		//置顶
		topInsert() {
			let url="../mpTop/index?id="+this.myCard.userId
			index.navigate_to(url)
		},
		dingyue() {
			index.redirectto('./myDingyue')
		},
		navBack() {
			index.navigate_back(1)
		},
		//刷新
		conBeizhu() {
			index.getPublicUserMember({},'/client/card/refreshCard','post',res=>{
				if(res.data.code == 200 && res.data.success){
					index.show_tips('刷新完成')
				}
			})
			// this.getCardDetail()
			// setTimeout(()=>{
			// 	index.show_tips('刷新完成')
			// },500)
		},
		getCardDetail(){
			index.getPublicUserMember({},'/client/card/detail','get',res=>{
				if(res.data.code == 200 && res.data.success){
					let data=res.data.result;
					if(!data.avatar){
						data.avatar='http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/default-avatar.png';
					}
					this.myCard=data;
					// let skills =this.myCard.skills.split(',')
					// let skillstr=''
					// if(skills&&skills.length>0){
					// 	for(let i =0;i<skills.length;i++){
					// 		if(i == (skills.length-1)){
					// 			skillstr+=skills[i]
					// 		}else{
					// 			skillstr+=skills[i]+','
					// 		}
					// 	}
					// 	this.myCard.skills = skillstr
					// }
					console.log(data);
				}
			})
			
		},
		navigator(url){
			index.navigate_to(url);
		}
	}
}
</script>

<style lang="scss" scoped>
@import url("@/static/css/publics.css");
@import url("@/static/css/Mybusinesscard.css");
.mptop{
		background-image: url('http://xgr.oss-cn-hangzhou.aliyuncs.com/icon/images/bg4.png');
		background-size: cover;
		height: 104rpx;
		color: #fff;
		padding: 26rpx;
		overflow: hidden;
		view:nth-child(1){
			margin-left: 196rpx;
			text{
				font-size: 36rpx;
				font-weight: bold;
				margin-left: 20rpx;
			}
		}
		view:nth-child(2){
			margin-left: 196rpx;
			font-size: 24rpx;
		}
	}
	.audit{ background: #F4F4F4; padding: 16rpx;}
	.audit .auditTitle{ color: #FF5964;}
	.audit .auditContent{ color: #424242; line-height: 48rpx;}
	
	.card-personper .audit{ margin-top: 20rpx;}
	.card-xiangmujingli .audit{ padding: 20rpx 0rpx; background: none; border-top: 1px solid #E5E5E5; margin-top: 20rpx;}
	.zhengshu { margin-bottom: 20rpx;}
	.zhengshu .contacts-zhengshu{ margin-bottom: 0rpx;}
</style>